package iit.projects.etaxi.model.service;

import java.util.TimerTask;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class ProcessSmsTimerService extends TimerTask {

	final Logger log = LoggerFactory.getLogger(ProcessSmsTimerService.class);
	private SmsService smsService;
	
	@Override
	public void run() {
		if(log.isTraceEnabled()){
			log.trace("Executing Run method in ProcessSmsTimerService");
		}
		long startTime = 0;
		startTime = System.currentTimeMillis();
		if(log.isDebugEnabled()){
			log.debug("Started Processing Sms at " + startTime);
		}
		
		smsService.processSms();
		
		if(log.isDebugEnabled()){
			log.debug("Time taken for Processing Sms = " + (System.currentTimeMillis() - startTime) + "ms");
		}
	}

	public void setSmsService(SmsService smsService) {
		this.smsService = smsService;
	}

}
